package com.efuture.servlet.session.logindemo.dao;

import com.efuture.servlet.session.logindemo.domain.User;
import com.efuture.servlet.session.logindemo.utils.JdbcUtils;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

public class UserDao {
    JdbcTemplate jdbcTemplate = new JdbcTemplate(JdbcUtils.getDataSource());
    public User login(User loginUser){
         String sql = "select * from user where username = ? and password = ?";
         User user = jdbcTemplate.queryForObject(sql,new BeanPropertyRowMapper<User>(User.class),loginUser.getUserName(),loginUser.getPassWord());
        return user;
    }
}
